import { createStore } from 'vuex'
import cart from './modules/cart'
import category from './modules/category'
import user from './modules/user'
import createPersistedState from 'vuex-persistedstate'// 导入数据持久化插件
export default createStore({
  state: {
  },
  getters: {
  },
  mutations: {
  },
  actions: {
  },
  modules: {
    cart,
    category,
    user
  },
  // 配置数据持久化
  // 默认存储在localStorage下
  plugins: [createPersistedState({
    // 本地存储名称
    key: 'erabbot-client-pc-124-store',
    // 指定需要本地存储的模块
    paths: ['user', 'cart']
  })]
})
